<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html>
<head>
<title>Register</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Custom Theme files -->
<!--theme-style-->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />	
<!--//theme-style-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="New Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, 
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!--fonts-->
<link href='http://fonts.useso.com/css?family=Lato:100,300,400,700,900' rel='stylesheet' type='text/css'>
<link href='http://fonts.useso.com/css?family=Roboto:400,100,300,500,700,900' rel='stylesheet' type='text/css'><!--//fonts-->
<!-- start menu -->
<link href="css/memenu.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/memenu.js"></script>
<script>$(document).ready(function(){$(".memenu").memenu();});</script>
<script src="js/simpleCart.min.js"> </script>
 <script type="text/javascript" src="/Jquery/jquery-2.1.4.min.js"></script>
</head>
<script type="text/javascript">
 function validate(){
   var result = document.getElementById("result");
   //校验用户名
  // alert("aaaa");
    var loginUsername = document.getElementById("loginUsername").value;
   // alert(loginUsername);
    var reg  =/^(?=.*[a-z])[a-z0-9]+/ig;//英文字母或英文字母和数字组合
    if(loginUsername==""){
    result.innerHTML="<font color=#cc0000>用户名不能为空</font>";
    return false;
    }
     if(!reg.test(loginUsername)){
     result.innerHTML="<font color=#cc0000>用户名必须是字母或字母和数字的组合</font>";
     return false;
    }
     if(loginUsername.length<6){
     result.innerHTML="<font color='#cc0000'>用户名的长度必须不小于6位</font>";
     return false;
    }
    //校验密码
    var password = document.getElementById("password").value;
     var password1= /^[0-9]+.?[0-9]*$/;  
    if(password==""){
      result.innerHTML="<font color='#cc0000'>密码不能为空</font>";
      return false;
    }else if(password.length<6||password.length>10){
     result.innerHTML="<font color='#cc0000'>密码的长度必须不少于六位不超过10位</font>";
      return false;
     }else if(!password1.test(password)){
     result.innerHTML="<font color='#cc0000'>对不起密码的格式不正确，必须为数字</font>";
     return false;
     }
     //校验邮箱
    var email = document.getElementById("email").value;
     var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
    if(email==""){
      result.innerHTML="<font color='#cc0000'>邮箱不能为空</font>";
      return false;
    }else if(!myreg.test(email)){
      result.innerHTML="<font color='#cc0000'>邮箱的格式不正确</font>";
      return false;
    }
       return true;
    }
    //ajax校验用户名不能重复
    
     $(function() {
        $("#loginUsername").blur(function() {
      
            $.ajax({
               url : "login_ajaxLoginUsername.action",//需要用来出来ajax请求的方法名
                dataType:"json",//设置需要返回的数据类型
                type : "post",
                 async:false,
                cache:false,
                data :{
                    //设置数据源
                    name:$("#loginUsername").val()
                },
               success:function(data){
           
            if(data.str=="100"){
             document.getElementById("result").innerHTML="用户名已注册";
             window.location.href="login_customerRegist.action";
             return false;
            }else{
              document.getElementById("result").innerHTML="用户名未注册";
              return true;
            }
            }
               
               
            });
        });
    });

</script>
<body>
<!--header-->
<div class="header">
	<div class="header-top">
		<div class="container">
			<div class="search">
					<form>
						<input type="text" value="Search " onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Search';}">
						<input type="submit" value="Go">
					</form>
			</div>
			<div class="header-left">		

					<div class="cart box_1">
			
					</div>
					<div class="clearfix"> </div>
			</div>
				<div class="clearfix"> </div>
		</div>
		</div>
		<div class="container">
			<div class="head-top">
				<div class="logo">
					<a href="index.html"><img src="images/logo.png" alt=""></a>	
				</div>
		  <div class=" h_menu4">
					<ul class="memenu skyblue">
					  <li class="active grid"><a class="color8" href="index.html"><h2>首页</h2></a></li>	
				   
			</div>
			
				<div class="clearfix"> </div>
		</div>
		</div>

	</div>

	
<!--content-->
<div class=" container">
<h1>REGISTER    &nbsp &nbsp PAGE</h1>
<div class=" register">

	
		 <center>
		
		  	  <form action="login_registCustomer.action" method="post" > 
		  	   <s:hidden id="cid"></s:hidden>
				 <div class="col-md-6 register-top-grid">
					<h3>Personal infomation</h3>
					 <div>
						<span><font color="#FF6600">登录名</font></span>
						<input type="text" name="loginUsername" id="loginUsername" onblur="return validate()"> 
					 </div>
					<div id="result"></div>
					 <div>
						<span><font color="#FF6600">密码</font></span>
						<input type="password" name="password" height="60px" width="200px" id="password" onblur="return validate()"/> 
					
					 </div>
				 <div id="result"></div>
					 <div>
						 <span><font color="#FF6600">Email</font></span>
						 <input type="text" name="email"  id="email" onblur="return validate()"/>
						
					 </div>
					  <div id="result"></div>
					  <div class="col-md-6 register-bottom-grid">
					  <input type="submit" value="submit" id="login"  onclick="return validate()">
					</div>
					
					 <div class="clearfix"> </div>
				</form>
				</center>
			</div>
</div>
<!--//content-->
<div class="footer">
				<div class="container">
			<div class="footer-top-at">
			
				<div class="col-md-4 amet-sed">
				<h4>MORE INFO</h4>
				<ul class="nav-bottom">
						<li><a href="#">How to order</a></li>
						<li><a href="#">FAQ</a></li>
						<li><a href="contact.html">Location</a></li>
						<li><a href="#">Shipping</a></li>
						<li><a href="#">Membership</a></li>	
					</ul>	
				</div>
				<div class="col-md-4 amet-sed ">
				<h4>CONTACT US</h4>
				
					<p>
Contrary to popular belief</p>
					<p>The standard chunk</p>
					<p>office:  +12 34 995 0792</p>
					<ul class="social">
						<li><a href="#"><i> </i></a></li>						
						<li><a href="#"><i class="twitter"> </i></a></li>
						<li><a href="#"><i class="rss"> </i></a></li>
						<li><a href="#"><i class="gmail"> </i></a></li>
						
					</ul>
				</div>
				<div class="col-md-4 amet-sed">
					<h4>Newsletter</h4>
					<p>Sign Up to get all news update
and promo</p>
					<form>
						<input type="text" value="" onfocus="this.value='';" onblur="if (this.value == '') {this.value ='';}">
						<input type="submit" value="Sign up">
					</form>
				</div>
				<div class="clearfix"> </div>
			</div>
		</div>
		<div class="footer-class">
		<p >Copyright &copy; 2015.Company name All rights reserved.More Templates <a href="http://www.cssmoban.com/" target="_blank" title="模板之家">模板之家</a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a></p>
		</div>
		</div>
</body>
</html>
			